package de.jmda.mview.typeshape;

import de.jmda.mview.typeshape.DisplayOptionsModel.DisplayMode;
import de.jmda.mview.typeshape.DisplayOptionsModel.DisplayStyle;

/**
 *
 */
public class DisplayOptionsModelUtil
{
	private DisplayOptionsModelContainer containerModel;
	private DisplayOptionsModel typeShapeModel;

	public DisplayOptionsModelUtil(
      DisplayOptionsModelContainer containerModel,
      DisplayOptionsModel typeShapeModel)
  {
	  super();
	  this.containerModel = containerModel;
	  this.typeShapeModel = typeShapeModel;
  }
	
	public static DisplayOptionsModelUtil create()
	{
		return
				new DisplayOptionsModelUtil(
						new DisplayOptionsModelContainer(), new DisplayOptionsModel());
	}
	
	public boolean displayTypeNameQualified()
	{
		if (containerModel.overrules)
		{
			return containerModel.displayOptionsType.displayStyle == DisplayStyle.QUALIFIED;
		}
		
		return typeShapeModel.displayOptionsType.displayStyle == DisplayStyle.QUALIFIED;
	}
	
	public boolean displayTypeNameSimple()
	{
		return !displayTypeNameQualified();
	}

	public boolean displayTypeAnnotations()
  {
		if (containerModel.overrules)
		{
			return containerModel.displayOptionsType.displayModeAnnotations == DisplayMode.SHOW;
		}
		
		return typeShapeModel.displayOptionsType.displayModeAnnotations == DisplayMode.SHOW;
  }

	public boolean displayFieldTypeQualified()
  {
		if (containerModel.overrules)
		{
			return containerModel.displayOptionsFields.displayStyleTypes == DisplayStyle.QUALIFIED;
		}
		
		return typeShapeModel.displayOptionsFields.displayStyleTypes == DisplayStyle.QUALIFIED;
  }

	public boolean displayFieldTypeSimple()
  {
		return !displayFieldTypeQualified();
  }

	public boolean displayMethodTypeQualified()
  {
		if (containerModel.overrules)
		{
			return containerModel.displayOptionsMethods.displayStyleReturnValue == DisplayStyle.QUALIFIED;
		}
		
		return typeShapeModel.displayOptionsMethods.displayStyleReturnValue == DisplayStyle.QUALIFIED;
  }

	public boolean displayMethodParameterQualified()
  {
		if (containerModel.overrules)
		{
			return containerModel.displayOptionsMethods.displayStyleParameter == DisplayStyle.QUALIFIED;
		}
		
		return typeShapeModel.displayOptionsMethods.displayStyleParameter == DisplayStyle.QUALIFIED;
  }

	public boolean displayFieldAnnotations()
  {
		if (containerModel.overrules)
		{
			return containerModel.displayOptionsFields.displayModeAnnotations == DisplayMode.SHOW;
		}
		
		return typeShapeModel.displayOptionsFields.displayModeAnnotations == DisplayMode.SHOW;
  }

	public boolean displayMethodAnnotations()
  {
		if (containerModel.overrules)
		{
			return containerModel.displayOptionsMethods.displayModeAnnotations == DisplayMode.SHOW;
		}
		
		return typeShapeModel.displayOptionsMethods.displayModeAnnotations == DisplayMode.SHOW;
  }

	public boolean displayFields()
  {
		if (containerModel.overrules)
		{
			return containerModel.displayOptionsFields.displayMode == DisplayMode.SHOW;
		}
		
		return typeShapeModel.displayOptionsFields.displayMode == DisplayMode.SHOW;
  }

	public boolean displayMethods()
  {
		if (containerModel.overrules)
		{
			return containerModel.displayOptionsMethods.displayMode == DisplayMode.SHOW;
		}
		
		return typeShapeModel.displayOptionsMethods.displayMode == DisplayMode.SHOW;
  }
}